package classDemo;

/**
 * @author Ajie
 * @date 2021/11/8
 * @function
 * 可以内部调用构造函数。
 * //AParent() {
 *   this("abc","3");}
 */
public class ClassConstruct {
    public static void main(String[] args) {
        AParent aParent = new AParent();
        System.out.println(aParent.toString());
    }
}
class AParent {
    String name;
    String age;

    public AParent() {
        this("abc","3");
    }

    public AParent(String name, String age) {
        this.name = name;
        this.age = age;
    }

    @Override
    public String toString() {
        return "AParent{" +
                "name='" + name + '\'' +
                ", age='" + age + '\'' +
                '}';
    }
}